package com.comiee.tankwar;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.utils.Align;
/**
 * 开始界面
 * @author comiee
 *
 */
public class StartScreen extends Game implements Screen {
	private Stage stage;
	private Label label;
	Tank tank;
	
	@Override
	public void create() {
		setScreen(this);
	}

	@Override
	public void show() {
		stage = new Stage();
		label = new Label("Top to start", new Label.LabelStyle(new BitmapFont(), Color.RED));
		label.setFontScale(10);
		label.setAlignment(Align.center);
		label.setPosition(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
		stage.addActor(label);
	}

	@Override
	public void render(float arg0) {
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		
		stage.act();
		stage.draw();
		if (Gdx.input.isTouched()) {
			setScreen(new GameScreen());
		}
	}

	@Override
	public void hide() {
		stage.dispose();
	}

	@Override
	public void resize(int arg0, int arg1) {
		//Game类中实现了这个方法，但是这里不重写这个方法会进入死循环
	}
}
